package miniqq.thread;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.OptionalDataException;

import miniqq.data.ProtocolData;
import android.os.Handler;
import android.os.Message;

public class RecieveDataThread extends Thread{
	private ObjectInputStream ins = null;
	private Handler handler;
	
	public RecieveDataThread(Handler _handler){
 
		handler = _handler;
	}
	
	public void run(){
		while(true){
			try {
				ProtocolData data = (ProtocolData)ins.readObject();
				Message msg = Message.obtain();
				msg.obj = data;
				handler.sendMessage(msg);
			} catch (OptionalDataException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
	}
}
